<!doctype html>
<html class="no-js">
<head>
<% include("/common/admin_head.html",{title: '商品列表', loadListJS: true}){}%>
</head>
<body>
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf app-padding-title">
        <div class="am-fl am-cf">
          <strong class="am-text-primary am-text-lg">商品管理</strong> / <small>商品列表</small>
        </div>
      </div>
      
      <hr data-am-widget="divider" class="am-divider am-divider-dotted am-margin-0" />
      
      <form class="am-form" id="listForm" action="${base}/product/list" method="post">
      <div class="am-g app-padding-toolbar">
        <div class="am-u-sm-7 am-u-md-4">
          <div class="am-btn-toolbar app-padding-toolbar-item">
            <div class="am-btn-group am-btn-group-sm">
              <button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/product/add';"><span class="am-icon-plus"></span> 新增</button>
              <button type="button" class="am-btn am-btn-default" onclick="deleteAll('${base}/product/delete');" id="deleteButton" disabled="disabled"><span class="am-icon-trash-o"></span> 删除</button>
            </div>
          </div>
        </div>
        <div class="am-u-sm-5 am-u-md-4 am-padding-0">
          <div class="app-padding-toolbar-item">
            <select name="property" data-am-selected="{btnWidth: '100%', btnSize: 'sm'}">
              <option value="name"<%if(property! == "name"){%>selected="selected"<%}%>>名称</option>
              <option value="url"<%if(url! == "url"){%>selected="selected"<%}%>>URL</option>
            </select>
          </div>
        </div>
        
        <div class="am-u-sm-12 am-show-sm-only am-margin-xs"></div>
        
        <div class="am-u-sm-12 am-u-md-4 am-padding-right-0">
          <div class="am-input-group am-input-group-sm">
            <input type="text" class="am-form-field" name="keyword" value="${keyword!}" />
            <span class="am-input-group-btn">
              <button id="searchButton" class="am-btn am-btn-default" type="button">搜索</button>
            </span>
          </div>
        </div>
      </div>
      
      <hr data-am-widget="divider" class="am-divider am-divider-dashed am-margin-0" />
      
      <div class="am-scrollable-horizontal">
        <table class="am-table am-table-striped am-table-hover table-main am-text-nowrap am-margin-bottom-0">
          <thead>
            <tr>
              <th><input type="checkbox" id="allCheck"></th>
              <th>序号</th>
              <th><div class="app-table-td-buttons-width-120">操作</div></th>
              <th>商品名称</th>
              <th>本店价格</th>
              <th>上架</th>
              <th>精品</th>
              <th>新品</th>
              <th>热销</th>
              <th>库存</th>
            </tr>
          </thead>
          <tbody>
            <%for(list in pager.list){%>
            <tr id="listTr${listLP.index}">
              <td><input type="checkbox" name="ids" value="${list.id}"></td>
              <td>${listLP.index}</td>
              <td>
                <div class="am-btn-group am-btn-group-xs">
                  <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary app-table-button-padding" onclick="location.href='${base}/product/edit?id=${list.id}'">
                    <span class="am-icon-pencil"> 编辑</span>
                  </button>
                  <button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger app-table-button-padding" onclick="deleteOne('${base}/product/delete?ids=${list.id}',${listLP.index})">
                    <span class="am-icon-trash-o"> 删除</span>
                  </button>
                </div>
              </td>
              <td><div class="am-text-truncate app-text-truncate-product-name">${list.name}</div></td>
              <td>${list.price}</td>
              <td>
                <%if(list.isMarketable == true){%>
                  <i class="am-icon-check"></i>
                <%}else{%>
                  <i class="am-icon-close"></i>
                <%}%>
              </td>
              <td>
                <%if(list.isBest == true){%>
                <i class="am-icon-check"></i>
                <%}else{%>
                <i class="am-icon-close"></i>
                <%}%>
              </td>
              <td>
                <%if(list.isNew == true){%>
                <i class="am-icon-check"></i>
                <%}else{%>
                <i class="am-icon-close"></i>
                <%}%>
              </td>
              <td>
                <%if(list.isHot == true){%>
                <i class="am-icon-check"></i>
                <%}else{%>
                <i class="am-icon-close"></i>
                <%}%>
              </td>
              <td>${list.store}</td>
            </tr>
            <%}%>
          </tbody>
        </table>
      </div>
      <!-- 分页 -->
      <%if (pager.list.~size > 0){%>
      <hr data-am-widget="divider" class="am-divider am-divider-dashed am-margin-0" />    
      <div class="am-margin-left am-text-xs"><% include("/admin/pager.html"){}%></div>
      <%}else{%>
      <h3 class="am-kai am-text-center am-margin-xs">没有找到任何记录!</h3>
      <%}%>
      </form>
    </div>
  </div>
  <!-- content end -->
</body>
</html>